<template>
  <ul class="todo-main">
    <Item v-for="todo in todos" :key="todo.id" :todo="todo" v-bind="$attrs" />
  </ul>
</template>

<script lang="ts" setup>
import Item from "./components/Item.vue";
import type { TodoList } from "../../api/types";

// 只要声明接受props数据，模板页面就能直接使用
defineProps<{
  todos: TodoList;
}>();

// 定义选项式内容
defineOptions({
  name: "List", // 定义组件名字：将来开发者调试工具就会显示这个名字，有利调试
});
</script>

<style scoped>
/*main*/
.todo-main {
  margin-left: 0px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 0px;
}

.todo-empty {
  height: 40px;
  line-height: 40px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding-left: 5px;
  margin-top: 10px;
}
</style>
